<?php
defined("_VALID_ACCESS") || die('Direct access forbidden');
    class Eyeworx_Inventory_ContactLensImportInstall extends ModuleInstall {

        public function install() {
            try {
                $type = array(
                    '1' => 'Disposable Clear',
                    '2' => 'Disposable Colored',
                    '3' => 'Extended Clear',
                    '4' => 'Extended Colored',
                    '5' => 'Dailies Clear',
                    '6' => 'Dailies Colored'
                );
                Utils_CommonDataCommon::new_array('Type', $type);

                $disp_clear = array(
                    '1' => '- 0.50',
                    '2' => '- 0.75',
                    '3' => '- 1.00'
                );
                Utils_CommonDataCommon::new_array('Type/1', $disp_clear);

                $disp_color = array(
                    '1' => '0.00',
                    '2' => '- 0.25',
                    '3' => '- 0.50',
                    '4' => '- 0.75',
                    '5' => '- 1.00',
                    '6' => '- 1.25',
                    '7' => '- 1.75',
                    '8' => '- 2.00',
                    '9' => '- 2.25',
                    '10' => '- 2.75',
                    '11' => '- 3.00'
                );
                Utils_CommonDataCommon::new_array('Type/2', $disp_color);

                $ex_clear = array(
                    '1' => '- 0.50',
                    '2' => '- 0.75',
                    '3' => '- 1.00'
                );
                Utils_CommonDataCommon::new_array('Type/3', $ex_clear);

                $ex_color = array(
                    '1' => '0.00',
                    '2' => '- 0.25',
                    '3' => '- 0.50',
                    '4' => '- 0.75',
                    '5' => '- 1.00',
                    '6' => '- 1.25',
                    '7' => '- 1.75',
                    '8' => '- 2.00',
                    '9' => '- 2.25',
                    '10' => '- 2.75',
                    '11' => '- 3.00'
                );
                Utils_CommonDataCommon::new_array('Type/4', $ex_color);

                $daily_clear = array(
                    '1' => '- 0.50',
                    '2' => '- 0.75',
                    '3' => '- 1.00'
                );
                Utils_CommonDataCommon::new_array('Type/5', $daily_clear);

                $daily_color = array(
                    '1' => '0.00',
                    '2' => '- 0.25',
                    '3' => '- 0.50',
                    '4' => '- 0.75',
                    '5' => '- 1.00',
                    '6' => '- 1.25',
                    '7' => '- 1.75',
                    '8' => '- 2.00',
                    '9' => '- 2.25',
                    '10' => '- 2.75',
                    '11' => '- 3.00'
                );
                Utils_CommonDataCommon::new_array('Type/6', $daily_color);


                $contactlens_recordset = new Eyeworx_Inventory_ContactLensImport_RBO_RBOContactLensImport();
                $contactlens_recordset->install();
                $contactlens_recordset->register_processing_callback(array('Eyeworx_Inventory_ContactLensImportCommon','submit_contactlens'));
                $contactlens_recordset->add_default_access();
                $contactlens_recordset->set_caption('Contact Lens Import');
            } catch (Exception $e) {
                return false;
            }
            return true;
        }

        public function uninstall() {
            try {
                $contactlens_recordset = new Eyeworx_Inventory_ContactLensImport_RBO_RBOContactLensImport();
                $contactlens_recordset->uninstall();

                Utils_CommonDataCommon::remove('Type');
                Utils_CommonDataCommon::remove('Type/1');
                Utils_CommonDataCommon::remove('Type/2');
                Utils_CommonDataCommon::remove('Type/3');
                Utils_CommonDataCommon::remove('Type/4');
                Utils_CommonDataCommon::remove('Type/5');
                Utils_CommonDataCommon::remove('Type/6');
            } catch (Exception $e) {
                return false;
            }
            return true;
        }

        public function requires($v) {
            return array(
                array('name'=>'Base/Lang','version'=>0),
                array('name'=>'Utils/RecordBrowser','version'=>0),
            );
        }

        public function info() {
            return array(
                'Author'=>'Pauline Joy Garcia',
                'Description'=>'Email: paulinejoygarcia@gmail.com'
            );
        }

        public function version() {
            return array('1.0');
        }

        public function simple_setup() {
            return array('package'=>__('Eyeworx'), 'option'=>__('Contact Lens Import'));
        }
    }

?>